<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>商品管理</title>
<link href="__PUBLIC__/admin/css/xc.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/admin/css/xc.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/admin/css/page.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/common-1.0.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
</head>
<body>
<nav class="breadcrumb mb10">
  <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> 积分商品列表
  <a class="btn btn-success radius r mr-20 btn-shua" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="pd-20">
  <form action="" method="post" id="myfrom1">
  <div class="text-c"><span class="select-box inline">
    <select class="select" name="is_on_sale">
      <option value="">全部</option>
      <option value="1">上架</option>
      <option value="2">下架</option>
    </select>
    </span> <span class="select-box inline">
    <select class="select" name="intro">
      <option value="0">全部</option>
      <option value="go_new">新品</option>
      <option value="go_hot">促销</option>
      <option value="go_recom">推荐</option>
    </select>
    </span> <span class="select-box inline">
    <select class="select" name="xcinput">
      <!--<option value="go_sn">商品货号</option>-->
      <option value="go_name">商品名称</option>
    </select>
    </span>
    <input type="text" name="keyword" placeholder="请输入搜索关键词" style="width:250px" class="input-text">
    <!--排序规则-->
    <input type="hidden" name="order_by" value="go_id">
    <input type="hidden" name="sort" value="desc">
    <button type="button" class="btn btn-success" onclick="ajax_get_table('myfrom1',1)"><i class="Hui-iconfont">&#xe665;</i> 搜商品</button>
  </div>
  </form>
  <div class="mt-10">
    <!--列表加载-->
    <div class="bDiv" style="height: auto;" id="ajax_return"> </div>
  </div>
</div>
<script>
$(document).ready(function(){
	// ajax 加载商品列表
	ajax_get_table('myfrom1',1);
});
// ajax 抓取页面 form 为表单id  page 为当前第几页
function ajax_get_table(form,page){
	cur_page = page; //当前页面 保存为全局变量
	$.ajax({
		type : "POST",
		url:"__MODULE__/Goods/ajaxPointsList/p/"+page,//+tab,
		data : $('#'+form).serialize(),// 你的formid
		success: function(data){
			$("#ajax_return").html('');
			$("#ajax_return").append(data);
		}
	});
}   
//数据批量操作
function op(){
	//获取操作
	var op_type = $('#operate').find('option:selected').val();
	if(op_type == 0){
		layer.msg('请选择操作', {icon: 2,time: 1000});   //alert('请选择操作');
		return;
	}
	//获取选择的id
	var selected = $('input[name*="check"]:checked');
	var selected_id = [];
	if(selected.length < 1){
		layer.msg('请选择批量处理编号', {icon: 2,time: 1000}); //            alert('请选择项目');
		return;
	}
	$(selected).each(function(){
		selected_id.push($(this).val());
	})
	$('#batch').find('input[name="selected"]').val(selected_id);
	$('#batch').find('input[name="type"]').val(op_type);
	$.ajax({
		type : 'post',
		url : "{:U('Goods/batch_process')}",
		data : $("#batch").serialize(),
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				layer.msg(res.msg, {icon: 1,time: 1000});
				ajax_get_table('myfrom1',cur_page);
			}else{
				layer.msg(res.msg, {icon: 2});
			}
		}
	})
}
//回调函数 
function call_back_fun(v){
	//layer.closeAll(); // 关闭窗口
	ajax_get_table('myfrom1',cur_page);
}
</script>
</body>
</html>